<%@page import="entity.Prod"%>
<%@page import="dao.ProdDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");

	String prodName = request.getParameter("prodname");
	String price = request.getParameter("price");
	
	try{
		Prod prod=new Prod();
		prod.setProdname(prodName);
		prod.setPrice(Float.parseFloat(price));
		ProdDao dao = new ProdDao();
		dao.add(prod);
		response.sendRedirect("home.jsp");
	} catch(NumberFormatException e) {
		response.sendRedirect("add.jsp?code=10002");
	}
	
	
%>
